package com.cvmars.jianyou.api.api;


import com.cvmars.jianyou.api.model.HttpResult;
import com.cvmars.jianyou.api.model.QiNiuModel;
import com.cvmars.jianyou.api.model.UserMode;
import com.cvmars.jianyou.model.ReadStatus;
import com.cvmars.jianyou.model.UserCoustomModel;
import com.cvmars.jianyou.model.UserInfoManager;
import com.cvmars.jianyou.model.UserListModel;
import com.cvmars.jianyou.model.UserModel;
import com.cvmars.jianyou.module.model.AppConfigModel;
import com.cvmars.jianyou.module.model.FindCommentList;
import com.cvmars.jianyou.module.model.FindListModel;
import com.cvmars.jianyou.module.model.FindModel;
import com.cvmars.jianyou.module.model.TokenListModel;
import com.cvmars.jianyou.module.model.TopicListModel;
import com.cvmars.jianyou.module.model.TopicModel;
import com.cvmars.jianyou.module.model.UserSeeModels;

import java.util.Map;

import io.reactivex.Observable;
import retrofit2.http.DELETE;
import retrofit2.http.Field;
import retrofit2.http.FieldMap;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.HTTP;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Path;
import retrofit2.http.Query;

/**
 * Created by hehaifeng on 2018/5/17.
 */

public interface ApiService {

    /**
     * 获取注册验证码
     */
    @FormUrlEncoded
    @POST("sms/")
    Observable<HttpResult<Object>> postRegisterSms(@Field("account") String username);

    /**
     * 注册
     */
    @FormUrlEncoded
    @POST("customer/enroll/")
    Observable<HttpResult<UserMode>> postRegister(@Field("account") String username
            , @Field("password") String password, @Field("code") String code);

    /**
     * 登录
     */
    @FormUrlEncoded
    @POST("customer/login/")
    Observable<HttpResult<UserMode>> postLogin(@Field("account") String username
            , @Field("password") String password);

    /**
     * 退出登录
     */
    @GET("customer/logout/")
    Observable<Object> getLoginExit();

    /**
     * 重置密码
     */
    @FormUrlEncoded
    @POST("customer/password/")
    Observable<HttpResult<Object>> postResetPassword(@Field("raw_password") String username
            , @Field("new_password") String password);


    /**
     * 忘记密码
     */
    @FormUrlEncoded
    @POST("customer/password/")
    Observable<HttpResult<UserMode>> postResetCodePassword(@Field("account") String username, @Field("password") String password
            , @Field("code") String code);


    /**
     * 获取七牛地址
     */
    @GET("/token/")
    Observable<HttpResult<QiNiuModel>> getQiNiuToken(@Query("file_name") String file_name, @Query("file_type") String file_type);


    /**
     * 请求用户信息
     */
    @GET("customer/profile/")
    Observable<HttpResult<UserModel>> getUseInfo();

    /**
     * 请求用户信息
     */
    @FormUrlEncoded
    @POST("customer/profile/")
    @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8")
//添加请求头注解
    Observable<HttpResult<UserModel>> UpdataInfoUseInfo(@FieldMap Map<String, String> paramsMap);


    /**
     * 请求用户信息
     */
    @FormUrlEncoded
    @POST("customer/profile/")
    @Headers("Content-Type:application/x-www-form-urlencoded; charset=utf-8")
//添加请求头注解
    Observable<HttpResult<UserModel>> UpdataInfoUseInfos(@FieldMap Map<String, Object> paramsMap);

    /**
     * 获取七牛地址
     */
    @GET("/im/")
    Observable<HttpResult<QiNiuModel>> getIMToken();


    /**
     * 添加关注/屏蔽某用户
     * 0：屏蔽， 1：关注， 默认： 1
     */
    @FormUrlEncoded
    @POST("/customer/following/")
    Observable<HttpResult<Object>> postUserFollow(@Field("customer_id") String coustomer_id
            , @Field("status") String status);


    /**
     * 取消关注
     * 0：屏蔽， 1：关注， 默认： 1
     */
    @DELETE("/customer/following/")
    Observable<HttpResult<Object>> deleteUserFollow(@Query("customer_id") String coustomer_id);


    /**
     * 获取我关注用户列表
     */
    @GET("/customer/followinglist/")
    Observable<HttpResult<UserListModel>> getFollowinglist(@Query("page") int page);


    /**
     * 获取关注我的用户列表
     */
    @GET("/customer/followerslist/")
    Observable<HttpResult<UserListModel>> getFollowingMeList(@Query("page") int page);

    /**
     * 获取我关注用户列表
     */
    @GET("/customer/lists/")
    Observable<HttpResult<UserCoustomModel>> getUserList(@Query("page") int page);


    /**
     * 获取附近的人用户列表
     */
    @GET("/customer/around/")
    Observable<HttpResult<UserCoustomModel>> getNearyUserList(@Query("page") int page);

    /**
     * 谁看过我用户列表
     */
    @GET("/stats/visitors/")
    Observable<HttpResult<UserSeeModels>> getVisitUserList(@Query("page") int page);


    /**
     * 有技能的人列表
     */
    @GET("/customer/has_skills/lists/")
    Observable<HttpResult<UserCoustomModel>> getTaskUserList(@Query("page") int page);


    /**
     * 相亲的人列表
     */
    @GET("/customer/single/lists/")
    Observable<HttpResult<UserCoustomModel>> getXiangqingUserList(@Query("page") int page);

    /**
     * 获取首页未关注用户列表
     */
    @GET("/customer/unknown/lists/")
    Observable<HttpResult<UserCoustomModel>> getHomeList(@Query("page") int page);

    /**
     * 获取我最近登录用户列表
     */
    @GET("/customer/active/lists/")
    Observable<HttpResult<UserCoustomModel>> getUserTimeList(@Query("page") int page);

    /**
     * 获取用户信息
     */
    @GET("/customer/{userid}/")
    Observable<HttpResult<UserModel>> getUserInfo(@Path("userid") String userid);


    /**
     * 发布动态
     */
    @FormUrlEncoded
    @POST("/moments/")
    Observable<HttpResult<Object>> postPublishFind(@Field("topics") String address, @Field("text") String text, @Field("is_hidden_name") boolean isNick
            , @Field("images") String images);


    /**
     * 发布动态
     */
    @FormUrlEncoded
    @POST("/moments/")
    Observable<HttpResult<Object>> postPublishFind(@Field("topics") String address, @Field("is_hidden_name") boolean isNick, @Field("text") String text);


    /**
     * 发布动态
     */
    @FormUrlEncoded
    @POST("/moments/topic/")
    Observable<HttpResult<Object>> postFindTopic(@Field("name") String address, @Field("desc") String desc, @Field("logo_url") String logo_url);

    /**
     * 获取动态列表
     */
    @GET("/moments/following/lists/")
    Observable<HttpResult<FindListModel>> getFindList(@Query("page") int page);

    /**
     * 获取最新动态列表
     */
    @GET("/moments/latest/lists/")
    Observable<HttpResult<FindListModel>> getNewFindList(@Query("page") int page);


    /**
     * 获取最新动态列表
     */
    @GET("/moments/search/")
    Observable<HttpResult<FindListModel>> getTopicFindList(@Query("topic_id") String topic_id, @Query("page") int page);


    /**
     * 获取动态详情
     */
    @GET("/moments/detail/{pg}/")
    Observable<HttpResult<FindModel>> getFindDetail(@Path("pg") String pg);

    /**
     * 获取动态列表
     */
    @GET("/moments/customer/{uid}/lists/")
    Observable<HttpResult<FindListModel>> getPersonFindList(@Path("uid") String uid, @Query("page") int page);


    /**
     * 删除动态
     */
    @DELETE("/moments/{id}/")
    Observable<HttpResult<Object>> deleteFind(@Path("id") String id);


    /**
     * 评论动态
     */
    @FormUrlEncoded
    @POST("/moments/{pk}/comment/")
    Observable<HttpResult<Object>> postFindComment(@Path("pk") String pk, @Field("text") String text);


    /**
     * 评论动态
     */
    @FormUrlEncoded
    @POST("/moments/{pk}/likes/")
    Observable<HttpResult<Object>> postPriseFind(@Path("pk") String pk, @Field("text") String text);


    /**
     * 评论动态
     */
    @FormUrlEncoded
    @POST("/moments/comment/{pk}/")
    Observable<HttpResult<Object>> postFindCommentPerson(@Path("pk") String pk, @Field("text") String text);


    /**
     * 删除评论
     */
    @DELETE("/moments/comment/{pk}/")
    Observable<HttpResult<Object>> deleteFindComment(@Path("pk") String pk);


    /**
     * 获取动态评论列表
     */
    @GET("/moments/{pk}/comment/")
    Observable<HttpResult<FindCommentList>> getFindCommentList(@Path("pk") String page);


    /**
     * 获取动态点赞列表
     */
    @GET("/moments/{pk}/likes/")
    Observable<HttpResult<FindCommentList>> getFindDianzhanList(@Path("pk") String page);


    /**
     * 获取动态点赞消息列表
     */
    @GET("/notices/lists/")
    Observable<HttpResult<FindCommentList>> getFindMessage(@Query("page") int page);


    /**
     * 获取动态点赞消息列表
     */
    @GET("/notices/status/")
    Observable<HttpResult<ReadStatus>> getReadStatus();


    /**
     * 获取访问个人主页的用户
     */
    @GET("/stats/records/unread/")
    Observable<HttpResult<ReadStatus>> getReadUserStatus();

    /**
     * 用户反馈
     */
    @FormUrlEncoded
    @POST("/feedback/")
    Observable<HttpResult<Object>> postFeedback(@Field("content") String content);


    /**
     * 获取动态点赞消息列表
     */
    @GET("/appconfig/")
    Observable<HttpResult<AppConfigModel>> getAppConfig();


    /**
     * 话题列表
     */
    @GET("/moments/topic/")
    Observable<HttpResult<TopicListModel>> getTopicList();

    /**
     * 话题列表
     */
    @GET("/moments/topic/{pk}/")
    Observable<HttpResult<TopicModel>> getTopicModel(@Path("pk") String pk);


    /**
     * 删除话题
     */
    @DELETE("/moments/topic/{pk}/")
    Observable<HttpResult<Object>> deleteFindTopic(@Path("pk") String pk);

    /**
     * 加群
     */
    @GET("/moments/topic/{pk}/chatgroup/")
    Observable<HttpResult<Object>> getGroup(@Path("pk") String pk);



    /**
     * 退群
     */
    @DELETE("/moments/topic/{pk}/chatgroup/")
    Observable<HttpResult<Object>> deleteGroup(@Path("pk") String pk);
}
